package com.ibeeking.found.upms.g.rest.controller.v1.feign;

import com.ibeeking.found.common.entity.LoginUserDTO;
import com.ibeeking.found.upms.api.common.dto.UserInfoDTO;
import com.ibeeking.found.upms.api.common.query.AccountLoginQuery;
import com.ibeeking.found.upms.g.rest.service.IGmcUserService;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName BunkInfoController控制器
 * @Description OAuth2.0客户端
 * @Author ibeeking
 * @Date 2020-10-22 10:34
 **/
@RestController
@RequestMapping("/g/user/feign/v1")
public class GmcUserFeignController {

    @Resource
    private IGmcUserService gmcUserServiceImpl;

    /**
     * 根据登录账号查询登录用户信息
     *
     * @param accountLoginQuery
     * @return
     */
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "根据登录账号查询登录用户信息")
    @PostMapping(value = "/queryAccountLogin")
    public LoginUserDTO queryAccountLogin(@RequestBody AccountLoginQuery accountLoginQuery) {
        return gmcUserServiceImpl.queryAccountLogin(accountLoginQuery);
    }

    /**
     * 根据userId查询全局用户信息
     *
     * @param userId
     * @return
     */
    @PostMapping(value = "/queryLoginUser/{userId}")
    public UserInfoDTO queryLoginUser(@PathVariable("userId") Long userId) {
        return gmcUserServiceImpl.queryLoginUser(userId);
    }
}
